package com.eig.course.config.mybatisplus;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author ：StudentLsj（李世界）
 * @date ：Created in 2022/11/05 下午 02:01
 * @description：自动填充配置类
 * @modified By：
 * @version:
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject, "gmt_create", Date.class, new Date());
        this.strictInsertFill(metaObject, "status_id", Integer.class,1);

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.strictUpdateFill(metaObject, "gmt_modified", Date.class, new Date());

    }
}
